<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h2>局部创建组件</h2>
      <tb-header></tb-header>
      <tb-body></tb-body>
    </div>

    <script src="./lib/vue3.js"></script>
    <script>
      const { createApp } = Vue;

      // 局部创建组件
      // 对象里面写的也是选项，必须要有template
      const TbHeader = {
        template: `
          <header>这是淘宝头部</header>
        `,
      };

      const TbBody = {
        template: `
          <main>这是淘宝主体</main>
        `,
      };

      const app = createApp({
        // 注册组件
        components: {
          TbHeader: TbHeader,
          TbBody,
        },
      });

      app.mount("#app");
    </script>
  </body>
</html>
